# -*- coding: utf-8 -*-
import scrapy
from ..xici.xiciparse import parseXiciResult
from ..items import *


class MyproxySpider(scrapy.Spider):
    name = 'myproxy'
    allowed_domains = ['xicidaili.com']
    start_urls = ['http://www.xicidaili.com/nn/']


    def start_requests(self):
        for i in self.start_urls:
            request=scrapy.Request(i, callback=self.parse, meta={'domain':i.split(".")[1]})
            yield request

    def parse(self, response):
        print response.meta
        self.logger.info(response.request['domain'])
        list=parseXiciResult(response)
        for r in list:
            item=proxyip(r)
            yield item

